#@head() #@header()
<title>融资需求管理</title>
#@aside("auxiliary")
<script type="text/javascript" src="#(path)/assets/js/jquery.tmpl.min.js"></script>
<div class="content-wrapper">
	<section class="content">
		<div class="nav-tabs-custom">
            <ul class="nav nav-tabs">
              <li class="active" ><a href="#(path)/admin/page/auxiliary-come" style="cursor:pointer" >企业用户</a></li>
            </ul>
            <div class="tab-content">
              <!-- 来访 -->
			  <div class="tab-pane active" id="tab_1">
				<button type="button" onclick="location.href='#(path)/admin/page/auxiliary-addenterprise'" class="btn btn-block btn-info" style="width:120px;margin-top:10px;float:left">新增企业用户</button>
				<div class="input-group margin" style="width:800px;float:left">
					<input type="text" class="form-control" >
					<span class="input-group-btn">
					  <button type="button" class="btn btn-info btn-flat">搜索</button>
					</span>
				</div>
				<div class="box-body">
					<table  id="example1" class="table table-striped">
						<thead>
							<tr>
								<th>用户ID</th>
								<th>手机号</th>
								<th>企业名称</th>
								<th>注册时间</th>
								<th>状态</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody id="userlist">
							
						</tbody>
					</table>
					<div class="box-footer clearfix">
					  <ul class="pagination pagination-sm no-margin pull-right">
						<li id="userlist1"><a href="#">首页</a></li>
						<li id="userlist2"><a href="#">上一页</a></li>
						<li><a href="#">第<span id="userlist5"></span>页 共<span id="userlist6"></span>页</a></li>
						<li id="userlist3"><a href="#">下一页</a></li>
						<li id="userlist4"><a href="#">尾页</a></li>
					  </ul>
					</div>
				</div>
			</div>
		</div>
	</div>
	</section>
</div>
#@footer()
<script id="userlistall" type="text/x-jquery-tmpl">
	<tr>
		<td>${id}</td>
		<td>${mobile}</td>
		<td>${real_name}</td>
		<td>${create_time}</td>
		<td>
			<span class="badge ${cal}">${status}</span>
		</td>
		<td>
			<div class="btn-group">
			  <button onclick="location.href='#(path)/admin/page/auxiliary-lkenterprise?id=${id}'" type="button" class="btn btn-info">查看</button>
			  
			</div>
		</td>
	</tr>
</script>
<script>
 $(document).ready(function(){
		var totalPage = 1;
		var pageNumber = 1;
		var usermobile = "";
		pageNumber = 1;
		$("#userlist").empty();
		userlist(1,"");
		$("#userlist5").html(pageNumber);
		$("#userlist1").click(function(){
			$("#userlist").empty();
			userlist(1,"");
			pageNumber = 1;
			$("#userlist5").html(pageNumber);
		});
		$("#userlist2").click(function(){
			if(pageNumber==1){
				alert("当前页是首页!");
			}else{
			$("#userlist").empty();
			pageNumber = pageNumber-1;
			userlist(pageNumber,"");
			$("#userlist5").html(pageNumber);
			}
		});
		$("#userlist3").click(function(){
			if(pageNumber==totalPage){
				alert("当前页是尾页!");
			}else{
			$("#userlist").empty();
			pageNumber = pageNumber +1;
			userlist(pageNumber,"");
			$("#userlist5").html(pageNumber);
			}
		});
		$("#userlist4").click(function(){
			$("#userlist").empty();
			userlist(totalPage,"");
			pageNumber = totalPage;
			$("#userlist5").html(pageNumber);
		});
		$("#seachuser").click(function(){
			$("#userlist").empty();
			usermobile = $("#usermobile").val();
			userlist(1,usermobile);
			pageNumber = totalPage;
			$("#userlist5").html(pageNumber);
		});
		function userlist(page,usermobile){
			$.getJSON("/user/list?token=#(session.token??)&page="+page+"&size=12&proStatus=0$&mobile="+usermobile, function(userli) {
				
				totalPage = userli.data.page.totalPage;
				$("#userlist6").html(totalPage);
				$.each(userli.data.page.list, function(i, item){ 
					if(item.pro_status=="0"){
						var status = "不通过";
						var cal = "bg-red";
					}else if(item.pro_status=="1"){
						var status = "通过";
						var cal = "bg-green";
					}else if(item.pro_status=="2"){
						var status = "审批中";
						var cal = "bg-yellow";
					}
					var userlist = {id:item.id,mobile:item.mobile,cal:cal,status:status,create_time:item.create_time,id:item.id,real_name:item.real_name};
					$("#userlistall").tmpl(userlist).appendTo('#userlist');
				});
			});	
		} 
});
   
</script> 

</body>
</html>

